package com.kdd.campus.sh.controller;

import com.kdd.campus.common.entity.CommonResult;
import com.kdd.campus.sh.po.ShAd;
import com.kdd.campus.sh.service.AdService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Auther: fcp
 * @Date: 2020/2/22 22:42
 * @Description:
 */
@Api(value = "广告管理" , tags = "ad")
@RestController
@RequestMapping("/ad")
@CrossOrigin
public class AdController {


    @Autowired
    private AdService adService;

    /***
     * 获取广告
     * @param location:广告级别
     * @return
     */
    @ApiOperation(value = "查询广告",notes = "分页查询ShProduct方法详情")
    @ApiImplicitParam(paramType = "path", name = "location" , value = "广告级别(0:首页的广告 1:消息页面  2:个人中心)" , dataType = "Integer" )
    @GetMapping(value = "/{location}")
    public CommonResult<List<ShAd>> findPage(@PathVariable int location){
        //调用ShProductService实现分页查询ShProduct
        List<ShAd> shAdList = adService.findAdList(location);
        return CommonResult.success(shAdList);
    }

}
